﻿using System;

using System.ComponentModel;
using System.Data;
using System.Data; 
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using WPFExcelReport.Helpers;
namespace WPFExcelReport.Controls
{
    public partial class TImage 
    {
        #region ==IsImageMax===========
        public static readonly DependencyProperty IsImageMaxProperty = DependencyProperty.Register("IsImageMax",
        typeof(bool), typeof(TImage),
        new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsImageMaxChanged));
        public bool IsImageMax
        {
            get
            {
                return (bool)GetValue(IsImageMaxProperty);
            }
            set
            {
                SetValue(IsImageMaxProperty, value);
                OnImageMaxChg(value);
            }
        }
        private static void OnIsImageMaxChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as TImage;
            if (src != null)
            {
                src.IsImageMax = (bool)e.NewValue;
            }
        }
        public virtual void OnImageMaxChg(bool ismax)
        {
        }
        #endregion
        #region ==PHOTOLINK===========
        public static readonly DependencyProperty PHOTOLINKProperty = DependencyProperty.Register("PHOTOLINK",
        typeof(string), typeof(TImage),
        new FrameworkPropertyMetadata("/ImagePackage;component/Images/Chart.png", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnPHOTOLINKChanged));
        public string PHOTOLINK
        {
            get
            {
                return (string)GetValue(PHOTOLINKProperty);
            }
            set
            {
                SetValue(PHOTOLINKProperty, value);
                OnPHOTOChg();
            }
        }
        private static void OnPHOTOLINKChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as TImage;
            if (src != null)
            {
                src.PHOTOLINK = (string)e.NewValue;
            }
        }
        public virtual void OnPHOTOChg()
        {

        }
        #endregion
        public TImage()
        {
            InitializeComponent();  
        }

        private void PrePageCommand(object sender, RoutedEventArgs e)
        {

        }

        private void NextPageCommand(object sender, RoutedEventArgs e)
        {

        }
        private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            IsImageMax = !IsImageMax;
        }

    }
}
